<template lang="pug">
Register(title="新增用户")
a-table(:columns="columns" :data-source="data" :pagination="false")
  template(#name="{ text }")
    a {{ text }}
  template(#customTitle)
    span
      smile-outlined
      | Name
  template(#tags="{ text: tags }")
    span
      a-tag(v-for="tag in tags" :key="tag" :color="tag === 'loser' ? 'volcano' : tag.length > 5 ? 'geekblue' : 'green'")
        | {{ tag.toUpperCase() }}
  template(#action="{ record }")
    span
      a Invite 一 {{ record.name }}
      a-divider(type="vertical")
      a Delete
      a-divider(type="vertical")
      a.ant-dropdown-link More actions
        down-outlined
center-container
  a-pagination(v-model="current" :total="50" show-less-items)
</template>
<script lang="ts" setup>
import { ref } from "vue"
import Register from "./Register.vue"

const current = ref(1)
const columns = [
  {
    dataIndex: 'name',
    key: 'name',
    slots: { title: 'customTitle', customRender: 'name' },
  },
  {
    title: 'Age',
    dataIndex: 'age',
    key: 'age',
  },
  {
    title: 'Address',
    dataIndex: 'address',
    key: 'address',
  },
  {
    title: 'Tags',
    key: 'tags',
    dataIndex: 'tags',
    slots: { customRender: 'tags' },
  },
  {
    title: 'Action',
    key: 'action',
    slots: { customRender: 'action' },
  },
];
const data = [
  {
    key: '1',
    name: 'John Brown',
    age: 32,
    address: 'New York No. 1 Lake Park',
    tags: ['nice', 'developer'],
  },
  {
    key: '2',
    name: 'Jim Green',
    age: 42,
    address: 'London No. 1 Lake Park',
    tags: ['loser'],
  },
  {
    key: '3',
    name: 'Joe Black',
    age: 32,
    address: 'Sidney No. 1 Lake Park',
    tags: ['cool', 'teacher'],
  },
];
</script>
